package com.eonmind.common.contract.enums.ai;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum ConversationMessageTypeEnum {
    USER(0, "user"),
    ASSISTANT(1, "assistant"),
    SYSTEM(2, "system"),
    TOOL(3, "tool");
    private final Integer code;
    private final String desc;

    public static ConversationMessageTypeEnum getByCode(Integer type) {
        for (ConversationMessageTypeEnum value : ConversationMessageTypeEnum.values()) {
            if (value.code.equals(type)) {
                return value;
            }
        }
        return null;
    }

    public static ConversationMessageTypeEnum getByDesc(String value) {
        for (ConversationMessageTypeEnum typeEnum : ConversationMessageTypeEnum.values()) {
            if (typeEnum.desc.equals(value)) {
                return typeEnum;
            }
        }
        return null;
    }
}
